package org.zh.sh.sv;

import org.zh.sh.entity.AppUser;
import org.zh.sh.util.jdbc.ZHOpenJdbcUtil;
import org.zh.sh.util.proxy.Service;
import org.zh.sh.util.jdbc.Transaction;

import java.util.Map;

import static org.zh.sh.util.Utils.removeEmpty;

@Service
public class AppUserSV extends AppUser {


    @Transaction
    public Map<String, Object> insert(Map<String, Object> appUser)  {
        return ZHOpenJdbcUtil.insertPri(tableName,removeEmpty(appUser));
    }

    @Transaction
    public void insertVoid(Map<String, Object> appUser) {
         ZHOpenJdbcUtil.insertVoid(tableName,removeEmpty(appUser));
    }
    @Transaction
    public int updateById(Map<String, Object> appUser)  {
      return  ZHOpenJdbcUtil.executeUpdate(updateAll,appUser.get(appRoles),appUser.get(appUserEmail),appUser.get(appUserGender),appUser.get(appUserJson),appUser.get(appUserName),appUser.get(appUserPassword),appUser.get(appUserTel),appUser.get(appUserId));
    }

    @Transaction(readOnly = true)
    public Map<String, Object> queryById(Long id) {
        return  ZHOpenJdbcUtil.executeQueryOne(queryById,id);
    }

    @Transaction
    public int deleteById(Long id)  {
        return  ZHOpenJdbcUtil.executeUpdate(deleteById,id);
    }

}
